<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <button id="btn" class="btn" type="button">点我</button>
    <button id="statistics" type="button">统计</button>

    <script type="module">
      import EVM from "./evm.mjs";
      const evm = new EVM({});

      function clickFn(e) {
        console.log(this === e.target);
      }

      evm.watch();
      document.getElementById("btn").addEventListener("click", clickFn);
      document.getElementById("btn").addEventListener("click", clickFn, true);
      document.getElementById("btn").addEventListener("click", clickFn, true);

      window.evm = evm;

      statistics.onclick = function () {
        evm.statistics().then((res) => {
          console.log("统计::", res);
        });
      };


      // setTimeout(function () {
      //   console.log("remove click 5000")
      //   document.getElementById("btn").removeEventListener("click", clickFn)
      // }, 5000)

      // setTimeout(function () {
      //   console.log("remove click 13000")
      //   document.getElementById("btn").removeEventListener("click", clickFn)
      // }, 13000)


      function onResize() { }

      window.addEventListener("resize", onResize);

      setTimeout(function () {
        window.removeEventListener("resize", onResize);
      }, 6000)
    </script>
  </body>
</html>
